<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>

    <head>
        <meta charset="UTF-8">
        <title>Insert title here</title>
    </head>

    <body>
        <table border="1" cellspacing="5" cellpadding="5">  
        </table>

        <script type="text/javascript" src="../js/jquery-3.3.1.js"></script>
     
        <script type="text/javascript">
        function myfun(abc){
            console.log($(abc).parent().siblings()[0].innerHTML);   
            var adminId = $(abc).parent().siblings()[0].innerHTML;
            
        }
            $(function() {
                var pageNo = 1;
                var pageSize = 5;

                $.ajax({
                    type: "GET",
                    url: 'selectAllAdministrator',
                    contentType: "application/json;charsetset=UTF-8",
                    data: {
                        'pageNo': pageNo,
                        'pageSize': pageSize
                    },
                    dataType: 'json',
                    async: true,
                    success: function(response) {
                    	var str="<tr>";            	
                    	for(var key in response[0]){
                    		str+="<th>"+key+"</th>";    
                    	}
                    	str+="<th>操作</th></tr>"
                    	$("table").append(str);
                    	$.each(response, function() {
                    		str="<tr>";
                    		for(var key in this){                  			
                    			str+="<td>"+this[key]+"</td>";			        
                            }
                    		str+="<td><button onclick='myfun(this)'>修改</button></td>"
                    		str+="</tr>";  		
                    		$("table").append(str);
                        });
                    },

                    error: function() {
                        alert("error");
                    }
                });

            })
        </script>
    </body>

</html>